Now that we always show the Bluetooth switch when there's a Bluetooth
adapter hiding somewhere, remove all the settings it used as storage.
If the user wants to really really disable any Bluetooth adapters in
their system, the gnome-bluetooth documentation explains how to do that
irrespective of GNOME:
https://gitlab.gnome.org/GNOME/gnome-bluetooth/#multiple-bluetooth-adapters
bluetooth: Show the Bluetooth switch in more cases
In older versions of GNOME, when a menu was used for Bluetooth devices,
we tried to avoid showing the Bluetooth menu to folks who didn't use
Bluetooth.
This kept causing problems as the menu would disappear if no
devices were setup and the platform "airplane mode" removed the
Bluetooth device from the USB bus, making it impossible to detect
whether a Bluetooth device existed, compared to a user unplugging a
removable Bluetooth device.
Carlos Garnacho [Wed, 14 Sep 2022 18:20:14 +0000 (20:20 +0200)]
status: Use fixed sorting of input sources on empty MRU
When updating the MRU sources if there was no prior MRU, we want
to go with the unmodified list of sources in visibility order.
However iterating over object properties happens in an undetermined
order, so the initial MRU list ends up picking a value at random.
In order to prefer the sources list in the same order than they
appear in the menu if there was no prior MRU, order the keys
when accessing it and building the initial list of sources.
Jonas Ådahl [Wed, 7 Sep 2022 21:17:22 +0000 (23:17 +0200)]
quickSettings: Update bind constraint offset on idle
Use Meta.LaterType.BEFORE_REDRAW to queue setting the bind constraint
offset in an idle callback. This is needed since the signals that
trigger updating the offset may be emitted during allocation, at which
point queuing new relayouts isn't ideal, since it could result in
relayout cycles. In this case, we really do want to relayout as a side
effect of another actors allocation, so make this explicit.
This fixes a few warnings such as:
The actor '<unnamed>[<StBoxLayout>:0x3138d70]' is currently inside an
allocation cycle; calling clutter_actor_queue_relayout() is not recommended
Andy Holmes [Mon, 5 Sep 2022 00:21:29 +0000 (17:21 -0700)]
panel: Add `PanelMenu.Button` menu when `menu-set` is emitted
When a `PanelMenu.Button` is added to the `statusArea`, its menu is
added to the `PopupMenuManager` if it has one at the time. If a menu is
added later or a new one set, the new menu is never added.
Move the call to `PopupMenuManager.addMenu()` from `_addToPanelBox()`
to `_onMenuSet()`, which is called when the `PanelMenu.Button` is added
and whenever it emits the `menu-set` signal.
Jonas Ådahl [Thu, 8 Sep 2022 10:31:15 +0000 (12:31 +0200)]
overviewControls: Don't update work area box when headless
When headless, we don't have a monitor we can derive a size from, so
don't even try, just let it be updated when we actually have a monitor
that will show stuff.
Sebastian Keller [Sun, 21 Aug 2022 14:00:40 +0000 (16:00 +0200)]
screencast: Always copy buffers in pipewiresrc
Pipewire 0.3.52 via commit a1f33a99 introduced a change that affects how
long pipewiresrc holds onto the pw_buffers it dequeued. Before that
change the pw_buffer was held until the end of the videoconvert element
at the beginning of the pipeline. After that change the pw_buffer was
held onto until the filesink at the end of the pipeline. This was
starving MetaScreenCastStreamSrc of pw_buffers to record new frames
into, resulting in the majority of frames being missed, especially in
situations in which the encoder was taking longer.
Pipewire 0.3.57 via commit 1ea1d525 will allow queuing the pw_buffer
early again via the `always-copy` option. This however is only a
workaround until a proper solution is found in either pipewire or
gstreamer that does not depend on copying the buffer contents and
instead queues the pw_buffer again after videoconvert as prior to a1f33a99.
Since it is not clear yet when a proper solution will arrive, this makes
use of `always-copy` as a workaround for now and should be reverted once
it is no longer needed.
Sebastian Keller [Sun, 28 Aug 2022 22:03:50 +0000 (00:03 +0200)]
signalTracker: Remove SignalTracker after its last signal got untracked
The object the SignalTracker belongs to is stored in a map managed by
the SignalManager which keeps a reference to that object. This map is
never destroyed nor is any entry ever removed. This leads to all objects
that ever had SignalTrackers used on them being kept alive even after
all references outside of the SignalTracker are long gone. This then
also extends to other objects which are leaked indirectly through
reference chains from these objects.
And if some of those objects are GObjects, this will prevent them from
being finalized, leaking further resources. A StWidget for example will
not release its shadow textures.
Fix this by destroying the SignalTracker and removing it from the
SignalManager once the last signal it was tracking has been untracked.
A WeakMap could have been used as well, but we need the Map to be
iterable in some of the following changes.
Sebastian Keller [Mon, 29 Aug 2022 02:19:28 +0000 (04:19 +0200)]
signalTracker: Don't try to create a new SignalTracker for disconnecting
After the next commit, when some classes, such as PopupMenuManager try
to disconnect via a destroy handler, the SignalTracker might have
already been destroyed, so trying to get it from the SignalManager will
cause it to create a new one, which will then try to connect to the
destroy signal of the already destroyed object.
This could for example be triggered by changing backgrounds.
Fix this by not doing anything in disconnectObject if there is no
SignalTracker for that object.
We need the SignalManager map top be iterable at shutdown for some of
the following changes. A WeakMap is not iterable. This revert changes it
back to a regular Map, which re-introduces the leaks caused by this.
Those will be fixed differently by the two followup commits.
Florian Müllner [Mon, 22 Aug 2022 22:06:42 +0000 (00:06 +0200)]
status/bluetooth: Indicate progress on toggle
Turning bluetooth on or off can be very slow – 10-15 seconds on
my system – and we currently don't provide any feedback that
something is indeed happening until the state changes at last.
Address this by using the `acquiring` icon when the adapter is
in a transitioning state.
Florian Müllner [Tue, 23 Aug 2022 14:30:32 +0000 (16:30 +0200)]
status/bluetooth: Expose adapter-state
GnomeBluetooth now exposes a more precise state than the binary
"adapter fully powerered on/off" property. Expose that on the
BtClient object to make it available to the toggle and indicator.
Carlos Garnacho [Sat, 30 Apr 2022 12:09:37 +0000 (14:09 +0200)]
padOsd: Figure out label/edition UI positions from unchanged fonts
We can figure out the position to render the text without resorting to
font sizes that make the whole text element sub-pixel size. As the
original labels in the SVG are themed invisible anyway, calculate the
button/ring/strip label and configuration UI position from their unchanged
size/location.
Commit 9168f6055e marked the parameter as nullable, which is in
conflict with the precondition check. But given that NULL is
valid for the underlying ClutterText (and GtkLabel accepts it
as well), there's no strong argument for disallowing NULL, so
remove the precondition check.
Florian Müllner [Tue, 30 Aug 2022 16:31:06 +0000 (18:31 +0200)]
status/volume: Request symbolic style for device menu items
We get device icons from gnome-volume-control, which itself may
get them from pulseaudio. That is, we don't have control over
whether icon names are symbolic.
As we do want menu items to use symbolic icons, enforce that
via CSS instead.
Florian Müllner [Mon, 22 Aug 2022 23:30:18 +0000 (01:30 +0200)]
quickSettings: Override StButton:label property
StButton already has a :label property, so we should override it
instead of shadowing it with a new property of the same name, like
we already do for :icon-name.
Milan Crha [Mon, 6 Jun 2022 15:31:23 +0000 (17:31 +0200)]
calendar: Correct handling of recurring events
When a recurring event has deleted a single instance, it's received
as an event modification, thus make sure all of the old instances
are removed before adding the event to the list of events.
Florian Müllner [Wed, 31 Aug 2022 10:51:54 +0000 (12:51 +0200)]
shell/screenshot: Plug memory leak
grab_screenshot_content() does not follow the usual pattern of
```
task = g_task_new (...);
g_task_run_in_thread (task, ...);
g_object_unref (task);
```
That means we hold the original reference throughout the operation,
and must release it ourselves when done.
Yao Wei (魏銘廷) [Mon, 29 Aug 2022 08:45:05 +0000 (16:45 +0800)]
switchMonitor: Fix initial selection on desktop
Due to !2056 the monitor config is 2 instead of 4 on the desktop.
However, the constant `Meta.MonitorSwitchConfigType.UNKNOWN` is fixed to
4, and may cause the initial selection to be out of index thus fail to
display the switcher. This replaces the above constant to the actual
length of the switcher items.
Florian Müllner [Mon, 15 Aug 2022 15:40:52 +0000 (17:40 +0200)]
status/network: Stop using radio-mode for VPN items
If a device has multiple connections set up, then at most one of
those can be active at a time, which is why they are presented
as radio items.
In contrast, VPN connections are not mutually exclusive, each can
be turned on or off independently. Setting :radio-mode on them
currently means that VPN connections can be activated, but never
disabled.
So instead of abusing the :radio-mode property to give VPN items
the UI we want, use regular items that reflect the desired behavior
and explicitly set up the UI the way we want.
Sebastian Keller [Sun, 28 Aug 2022 22:03:50 +0000 (00:03 +0200)]
signalTracker: Use WeakMap in SignalManager to avoid leaking objects
The object the SignalTracker belongs to is stored in a map managed by
the SignalManager which keeps a reference to that object. This map is
never destroyed nor is any entry ever removed. This leads to all objects
that ever had SignalTrackers used on them being kept alive even after
all references outside of the SignalTracker are long gone. This then
also extends to other objects which are leaked indirectly through
reference chains from these objects.
And if some of those objects are GObjects, this will prevent them from
being finalized, leaking further resources. A StWidget for example will
not release its shadow textures.
When saving a screenshot, the GdkPixbuf created would be left
with a dangling reference after saving to disk (either leaked
on errors, or via an extra reference on success). Always unref
the pixbuf so it's either destroyed on error or there is a single
reference fully transferred to the caller of the function.
Carlos Garnacho [Tue, 23 Aug 2022 16:29:09 +0000 (18:29 +0200)]
keyboard: Use the right property to figure out modifiers set size
During development of the OSK updates, this._modifiers turned from an
array into a Set(), but this location missed switching from length()
to size() to get the cardinality of the contained values.
As a result, the OSK misbehaved and resorted for key event forwarding
for impossible keyvals, instead of handing them directly to the IM.